# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php83-pecl-apcu
_extname=apcu
pkgver=5.1.23
pkgrel=0
pkgdesc="PHP 8.3 extension APC User Cache - PECL"
url="https://pecl.php.net/package/apcu"
arch="all"
license="PHP-3.01"
_phpv=83
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev"
checkdepends="$_php-pcntl"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"
provides="$_php-apcu=$pkgver-r$pkgrel" # for backward compatibility
replaces="$_php-apcu" # for backward compatibility

install_if="php-$_extname php$_phpv"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv
	make
}

check() {
	local _modules=/usr/lib/$_php/modules
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test \
		PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=$_modules/pcntl.so \
		-d extension=modules/$_extname.so" TESTS=--show-diff
	$_php -d extension="$builddir"/modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	install -D -m644 apc.php "$pkgdir"/usr/share/$_php/apcu/apc.php

	local _confdir="$pkgdir"/etc/$_php/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
89e9f10f5d8d1a9503132e80140680be2a10d96f957f69b2f77cc1c496d15cc26dfe4c0368ebe46c72c68d1b4a794d3ddc95942b02d3ba5e8c971b09969058d8  php-pecl-apcu-5.1.23.tgz
"
